package Leetcode第二期;

/**
 * @author : K k
 * @date : 14:33 2020/9/20
 */
public class 对称二叉树_101 {
    public boolean isSymmetric(TreeNode root) {
        if(root==null) {return true;}

        return recur(root.left,root.right);
    }

    public boolean recur(TreeNode left,TreeNode right) {
        //三种情况
        if(left==null && right==null){
            return true;
        }
        if(left!=null && right!=null && left.val==right.val){
            return recur(left.left,right.right) && recur(left.right,right.left);
        }
        return false;
    }
}
